package internal

import (
	"github.com/BurntSushi/toml"
	"sync"
)

var (
	bcLock sync.RWMutex
	bcInst *BizConfig
)

type BizConfig struct {
}

func ReloadBizConfig(path string, _ bool) {
	var bc BizConfig
	if _, err := toml.DecodeFile(path, &bc); err != nil {
		panic(err)
	}

	bcLock.Lock()
	bcInst = &bc
	bcLock.Unlock()
}

func GetBizConfig() *BizConfig {
	bcLock.RLock()
	defer bcLock.RUnlock()
	return bcInst
}
